n = int(input())
juzhen = []
for i in range(n):
    a = list(map(int, input().split()))
    juzhen.append(a)
result = [0, 0, 0, 0]
for i in range(n):
    for j in range(n):
        if juzhen[i][j] >= 3:
            result[i] += 1
for i in range(n):
    if result[i] == max(result):
        print(i+1)
        break
